mod hello;
mod string;
mod list;
mod hash;
mod subscribe;
mod set;
mod zset;
mod stream;
mod server;

pub(crate) use hello::*;

use crate::resp::{CommandArgs, ToCommandArgs};


pub enum SetMode {
    Always,
    IfNotExists,
    IfExists,
}

impl ToCommandArgs for SetMode {
    fn write(&self, args: &mut CommandArgs) {
        match self {
            SetMode::Always => {}
            SetMode::IfNotExists => args.push("NX".as_bytes().to_vec()),
            SetMode::IfExists => args.push("XX".as_bytes().to_vec()),
        }
    }
}

pub enum InsertMode {
    Before,
    After,
}

impl ToCommandArgs for InsertMode {
    fn write(&self, args: &mut CommandArgs) {
        match self {
            InsertMode::Before => args.push("BEFORE".as_bytes().to_vec()),
            InsertMode::After => args.push("AFTER".as_bytes().to_vec()),
        }
    }
}

pub enum ListPosition {
    Left,
    Right,
}

impl ToCommandArgs for ListPosition {
    fn write(&self, args: &mut CommandArgs) {
        match self {
            ListPosition::Left => args.push("LEFT".as_bytes().to_vec()),
            ListPosition::Right => args.push("RIGHT".as_bytes().to_vec()),
        }
    }
}
